attribute vec3 pos;
attribute vec2 texcoord;
attribute vec3 normal;

uniform mat4 M;
uniform mat4 P;
uniform mat4 V;
uniform mat4 NM;

uniform vec3 U_LightPos;
uniform vec3 U_EyePos;
uniform vec4 U_DiffuseLightColor;
uniform vec4 U_DiffuseMaterial;
uniform vec4 U_SpecularLightColor;
uniform vec4 U_SpecularMaterial;

varying vec4 V_Color;

void main()
{
	//L vecotr
	vec3 L = U_LightPos;
	L = normalize(L);
	//N vector
	vec3 n = normalize(mat3(NM) * normal);

	float intensity = max(0.0, dot(L, n));
	if(intensity > 0.5){
		V_Color = vec4(0.4, 0.4, 0.4, 1.0);
	}
	else{
		V_Color = vec4(0.1, 0.1, 0.1, 1.0);
	}

	gl_Position = P * V * M * vec4(pos, 1.0);;
}
